package com.bible.test.pad.activity.fragment;

import android.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ScrollView;
import android.widget.TextView;


public class DetailsFragment extends Fragment {
	
	private static final String TAG = DetailsFragment.class.getSimpleName();
	
	private String[] goodsDetails = {   
            "蛋糕：好好吃。",    
            "礼物：礼轻情重。",    
            "邮票：环游世界。",    
            "爱心：世界都有爱。",   
            "鼠标：反应敏捷。",   
            "音乐CD：酷我音乐。"};
	
	@Override
    public void onCreate(Bundle savedInstanceState){
    	Log.d(TAG, "create titles fragment");
    	super.onCreate(savedInstanceState);
    }

	@Override  
    public void onActivityCreated(Bundle savedInstanceState) {  
        super.onActivityCreated(savedInstanceState);  
  
    }  
  
    @Override  
    public void onSaveInstanceState(Bundle outState) {  
        super.onSaveInstanceState(outState);  
    }  
  
    @Override  
    public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {  
        if (container == null) {              
            return null;  
        }   
        ScrollView scroller = new ScrollView(getActivity()); 
        TextView text = new TextView(getActivity());
        scroller.addView(text);
        Bundle args = this.getArguments();
        //if( savedInstanceState != null && savedInstanceState.containsKey("position") ){
        if( args != null && args.containsKey("position") ){
        	int index = args.getInt("position");
        	text.setText( goodsDetails[index] );
        }else{
        	text.setText("没有选中商品");
        }
        text.setTextSize( 23 );
        return scroller;  
    }  
}
